Virtual Hard Disk Size Increase

From Kicksecure
Jump to navigation Jump to search
Advanced Documentation Previous page: sparse files Index page: Advanced Documentation Next page: Shrink Virtual Harddisk Virtual Hard Disk Size Increase

Get more disk space. Increase the size of a virtual disk. Expand virtual machine storage capacity. Possible with Qubes, Kicksecure-Qubes, Kicksecure KVM, and Kicksecure VirtualBox.

Overview

[edit]

Note: When you increase the size of a virtual disk on the host, the additional space will not necessarily become available automatically inside the virtual machine (VM). Claiming the new space is required.

In summary, the following steps are required to grow the disk.

1 Back up important data.

2 On the host operating system (OS): Increase the size of the virtual disk.

3 Restart the virtual machine.

4 Inside the virtual machine (VM): At the grub boot menu, make a temporary kernel boot parameter change by setting bdev_allow_write_mounted=1 to allow claiming the new space.

Elaborated below.

5 Inside the VM: Claim the new space.

6 Inside the VM: Reboot.

7 Done.

Virtual Machines

[edit]

If more disk space is required for virtual hard disks, the good news is that this is simple for Kicksecure VMs. Nothing special is required, because it is just another VM image. Any suggestions found for your virtualizer will similarly work for Kicksecure. Self Support First Policy applies.

1 Back up important data.

Either move important files via shared folders [1] or make a full clone of VMs in each snapshot state in case something goes wrong.

2 Select your virtualizer.

VirtualBox

3 On the host:

4 Make a clone of all states of any existing virtual machine in case something goes wrong.

5 Delete all existing VM snapshots.

6 Grow the disk.

Either,

  • A Using the VirtualBox graphical user interface (GUI):

VirtualBoxFileToolsVirtual Media Managerselect virtual hard diskadjust the size slider

or,

  • B Using the command line interface (CLI). See footnote. [2]

7 During VM boot:

8 Restart the virtual machine and stop at the grub boot menu.

9 At the boot menu, boot into persistent mode - sysmaint session and make a Temporary Kernel Boot Parameter Change by changing bdev_allow_write_mounted=0 to bdev_allow_write_mounted=1 for this boot only. [3]

10 Inside the VM:

11 Inspect Kernel Command Line.

Optional. For verification of kernel boot parameter change.

cat /proc/cmdline | grep --color bdev_allow_write_mounted

Expected output:

bdev_allow_write_mounted=1

12 Version-specific notice.

  • Build Version 17.4.0.5 and above: No special notice.
  • Older build versions: See footnote. [4]

13 Reboot.

14 Done.

The procedure is complete.

KVM

3 On the host:

4 Delete all existing snapshots.

5 Increase the disk size.

1G below should be replaced with the amount of disk space to be added in gigabytes.

qemu-img resize vmdisk.img +1G

6 During VM boot:

7 Restart the virtual machine and stop at the grub boot menu.

8 At the boot menu, boot into persistent mode - sysmaint session and make a Temporary Kernel Boot Parameter Change by changing bdev_allow_write_mounted=0 to bdev_allow_write_mounted=1 for this boot only. [5]

9 Inside the VM:

10 Inspect Kernel Command Line.

Optional. For verification of kernel boot parameter change.

cat /proc/cmdline | grep --color bdev_allow_write_mounted

Expected output:

bdev_allow_write_mounted=1

11 Follow the same version-specific instructions as in the VirtualBox section to claim the new space.

12 Reboot.

13 Done.

The procedure is complete.

Qubes

3 Refer to the Resizing Disk Imagearchive.org iconarchive.today icon Qubes OS user documentation.

4 Done.

Build from Source Code

[edit]

Refer to Build Kicksecure from Source Code and use this command line parameter:

--vmsize 200G

See Also

[edit]

Footnotes

[edit]
  1. Find the folder of the virtual hard disk. Run the following command. Notes:
    • Adjust the filename of the virtual hard disk.
    • Adjust 100000 to, for example, 200000.
    VBoxManage modifyhd "Kicksecure-disk1.vdi" --resize 100000
  2. Alternatively, advanced users can make Permanent Configuration Changes. This is more complicated.
  3. 1 Install a partitioning tool. Note: No longer required for Build Version 17.3.9.2 and above.

    Build version 17.3.9.2 and below, please press Expand on the right.

    Install a tool such as gparted that can grow the filesystem.

    Install package(s) gparted following these instructions:

    1 Platform specific notice.

    2 Update the package lists and upgrade the system.

    sudo apt update && sudo apt full-upgrade

    3 Install the gparted package(s).

    Using apt command line --no-install-recommends option is in most cases optional.

    sudo apt install --no-install-recommends gparted

    4 Platform specific notice.

    • Kicksecure: No special notice.
    • Kicksecure-Qubes: Shut down Template and restart App Qubes based on it as per Qubes Template Modification.

    5 Done.

    The procedure of installing package(s) gparted is complete.

    Start the partitioning tool.

    Start a terminal.

    lxsudo gparted

    Claim the new space.

    • Increase the size of the filesystem.
    • The user probably does not wish to create a new partition. Instead, the existing partition should be expanded.

    2 Fix the partition type code.

    Note: No longer required for build version 17.4.0.4 and above.

    Build version 17.4.0.4 and below, please press Expand on the right.

    This is a fix for Failed to start systemd-repart.service - Repartition Root Diskarchive.org iconarchive.today icon.

    sudo sgdisk --typecode='3:4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709' /dev/sda

  4. Alternatively, advanced users can make Permanent Configuration Changes. This is more complicated.

Advanced Documentation Previous page: sparse files Index page: Advanced Documentation Next page: Shrink Virtual Harddisk

Notification image

We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 14 year success story and maybe DONATE!